#include "ThreadPool.hpp"
#include "Task.hpp"
#include <thread>
#include <ctime>

int main()
{
    prctl(PR_SET_NAME, "master");

    const string operators = "+-*/%";

    unique_ptr<ThreadPool<Task>> tp(ThreadPool<Task>::getInstance());
    tp->start();

    srand(time(nullptr));
    while(true)
    {
        int one = rand()%50;
        int two = rand()%50;
        char oper = operators[rand()%operators.size()];
        Log() <<"主线程派发计算任务: " << one << oper << two << "=?" << '\n';
        Task t(one, two, oper);
        tp->push(t);
    }
}
